<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('货箱详情列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>货箱编号：</label>
                            <input type="text" name="boxCode"/>
                        </li>
                        <li>
                            <label>商品编码：</label>
                            <input type="text" name="spuCode"/>
                        </li>
                        <li>
                            <label>入库单：</label>
                            <input type="text" name="entryCode"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:box:detail:add">
                <i class="fa fa-plus"></i> 添加
            </a>-->
            <a class="btn btn-primary single disabled" onclick="$.operate.edit()"
               shiro:hasPermission="system:box:detail:edit">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="system:box:detail:remove">
                <i class="fa fa-remove"></i> 删除
            </a>
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:box:detail:export">
                <i class="fa fa-download"></i> 导出
            </a>
            <a class="btn btn-danger multiple disabled" onclick="bigProductEntry()"
               shiro:hasPermission="system:box:detail:remove">
                <i class="fa fa-remove"></i> 大件商品入库
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:detail:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:detail:remove')}]];
    var prefix = ctx + "wcs/box/detailInfo";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "货箱详情",
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                {
                    field: 'boxCode',
                    title: '货箱编号'
                }, {
                    field: 'spuName',
                    title: '商品名称'
                },
                {
                    field: 'spuId',
                    title: '商品ID'
                },
                {
                    field: 'skuCode',
                    title: 'sku编码'
                },
                {
                    field: 'specCode',
                    title: '规格编码'
                },
                {
                    field: 'entryCode',
                    title: '入库单'
                },
                {
                    field: 'weight',
                    title: '总重量'
                },
                {
                    field: 'quantity',
                    title: '数量'
                },
                {
                    field: 'warrantyDate',
                    title: '保质期'
                },
                {
                    field: 'produceDate',
                    title: '生产日期'
                },
                {
                    field: 'supplierCode',
                    title: '供应商'
                },
                {
                    field: 'producerId',
                    title: '生产商'
                },
                {
                    field: 'batchCode',
                    title: '批次编号'
                },
                {
                    field: 'purchaseOrderCode',
                    title: '采购单'
                },
                {
                    field: 'saleOrderCode',
                    title: '销售单'
                },
                {
                    field: 'numberOfPerBox',
                    title: '标品每箱包含的物件数量/份数'
                },
                {
                    field: 'weightOfPerBox',
                    title: '标品每份重量'
                },
                {
                    field: 'unit',
                    title: '单位'
                },
                {
                    field: 'volume',
                    title: '单位体积(每份/件/箱体积)'
                },
                {
                    field: 'shelfLife',
                    title: '保质期生产日期+保质期(品类保质期预留，入库单输入保质期为主，供应商乱输保质期不管，入库单保质期>原料保质期>品类保质期)'
                },
                {
                    field: 'spuGradeId',
                    title: '原材料等级'
                },
                {
                    field: 'inBulk',
                    title: '是否散装包装：0，否；1，是；非散装未标准包装，已打包好了，一包一包拿，无需称重'
                },
                {
                    field: 'inMerge',
                    title: '是否合箱物品'
                },
                {
                    field: 'inReturn',
                    title: '是否退货入库商品'
                },
                {
                    field: 'boxLayer',
                    title: '货箱层(货箱可包含N层)'
                },
                {
                    field: 'remark',
                    title: '备注'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function bigProductEntry() {
        table.set();
        var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
        if (rows.length == 0) {
            $.modal.alertWarning("请至少选择一条记录");
            return;
        }
        var url = '/wcs/box/detailInfo/bigProductEntryPage?ids=' + rows.join();
        $.modal.open("修改" + table.options.modalName, url);
    }
</script>
</body>
</html>